import xadmin
from apps.courses.models import Course, CourseResource, Lesson, Video


class CourseAdmin(object):
    list_display = ['name', 'desc', 'detail', 'degree', 'learn_time', 'students', 'fav_nums', 'image', 'click_nums',
                    'add_time']
    list_filter = ['name', 'desc', 'detail', 'degree', 'learn_time', 'students', 'fav_nums', 'image', 'click_nums']

    search_fields = ['name', 'desc', 'detail', 'degree', 'learn_time', 'students', 'fav_nums', 'image', 'click_nums',
                     'add_time']


class LessonAdmin(object):
    list_display = ['course','name','add_time']

    list_filter =  ['course','name']

    search_fields = ['course','name','add_time']


class VideoAdmin(object):
    list_display = ['lesson','name','add_time']

    list_filter =  ['lesson','name']

    search_fields = ['lesson','name','add_time']


class CourseResourceAdmin(object):
    list_display = ['course','name','download','add_time']

    list_filter =  ['course','name','download']

    search_fields = ['course','name','download','add_time']

















xadmin.site.register(Course, CourseAdmin)
xadmin.site.register(Lesson,LessonAdmin)
xadmin.site.register(Video,VideoAdmin)
xadmin.site.register(CourseResource,CourseResourceAdmin)
